package com.briup.jz.service.impl;

import com.briup.jz.bean.Carousel;
import com.briup.jz.dao.CarouselMapper;
import com.briup.jz.dao.CertificationApplyMapper;
import com.briup.jz.service.ICarouselService;
import com.briup.jz.utils.CustomerException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CarouselServiceImpl implements ICarouselService {

    //依赖注入
    @Resource
    private CarouselMapper carouselMapper;



    @Override
    public void saveOrUpdat(Carousel carousel) throws CustomerException {

        if (carousel.getId()!=null){
            //更新操作
            carouselMapper.updateByPrimaryKey(carousel);
        }else {
            carouselMapper.insert(carousel);
        }
    }

    @Override
    public Carousel query(Long id) {
        return  carouselMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteById(Long id) throws CustomerException {

        carouselMapper.deleteByPrimaryKey(id);
    }
}
